﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace SomeEngine.Classes
{
    public class GameObject
    {
        /// <summary>
        /// Object texture. Get and set allowed.
        /// </summary>
        public Texture2D texture { get; set; }

        /// <summary>
        /// Position and velocity vectors. Get and set allowed.
        /// </summary>
        public Vector2 position { get; set; }
        public Vector2 velocity { get; set; }

        /// <summary>
        /// Object width and height, alias to object texture width/height. Get allowed.
        /// </summary>
        public int width { get { return texture.Width; } }
        public int height { get { return texture.Height; } }

        /// <summary>
        /// Object bounds. Get allowed.
        /// </summary>
        public Rectangle bounds
        {
            get
            {
                return new Rectangle((int)position.X, (int)position.Y, width, height);
            }
        }

        /// <summary>
        /// Is object alive? Get and set allowed.
        /// </summary>
        public bool isAlive { get; set; }

        /// <summary>
        /// Base game object constructor. Sets isAlive to true.
        /// </summary>
        /// <param name="texture">Object texture.</param>
        public GameObject(Texture2D texture)
        {
            this.texture = texture;
            this.isAlive = true;
        }

        /// <summary>
        /// Base game object constructor. Sets isAlive to true.
        /// </summary>
        /// <param name="texture">Object texture.</param>
        /// <param name="position">Object position.</param>
        public GameObject(Texture2D texture, Vector2 position)
        {
            this.texture = texture;
            this.position = position;
            this.isAlive = true;
        }

        /// <summary>
        /// Base game object constructor. Sets isAlive to true.
        /// </summary>
        /// <param name="texture">Object texture.</param>
        /// <param name="position">Object position.</param>
        /// <param name="velocity">Object velocity.</param>
        public GameObject(Texture2D texture, Vector2 position, Vector2 velocity)
        {
            this.texture = texture;
            this.position = position;
            this.velocity = velocity;
            this.isAlive = true;
        }
    }
}
